/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.db;

import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
/**
 * @author Administrador.
 */
public class Conector {

    public static Connection conn = null;
    
    public static Connection getConexion(){
        try{
            Context initContext = new InitialContext();
            DataSource ds = (DataSource)initContext.lookup("java:/comp/env/jdbc/siss");
            conn = ds.getConnection();
        }catch (SQLException ex) {
            System.out.println("Error! al conectarse a la base de datos: "+ex.getMessage());
        }catch (NamingException m) {
            System.out.println("Error al conectar mediante pool NamingException: "+m.getMessage());
        }
        return conn;
    }
}
